#!/usr/bin/python3
# /usr/bin/env python
# -*- coding: UTF-8 -*-

import wordcloud
import imageio
# 构建并配置词云对象w
mk = imageio.v2.imread("background.png")
w = wordcloud.WordCloud(width=1000,
                        height=700,
                        background_color='white',
                        mask=mk,
                        scale=15,
                        font_path='msyh.ttc')

txtlist = ["低碳先锋", "驾驶专家", "语音精灵", "城市探索者", "能量补给", "AI达人", "余音绕梁", "听书万卷",
           "大开眼界", "升级达人", "辅助驾驶专家", "泊车专家", "竞速选手", "拉力赛车手", "文明好司机", "续航达人",
           ]

string = " ".join(txtlist)
w.generate(string)
# 将词云图片导出到当前文件夹
w.to_file('output5-village.png')